<?php
    if (!isset($staffuser)) {
        $staffuser['staffuser_login'] = "";
        $staffuser['staffuser_email'] = "";
        $staffuser['staffuser_title'] = "";
        $staffuser['staffuser_id'] = -1;
        $staffuser['staffuser_role'] = 0;
        $staffuser = (object) $staffuser;
    }
?>
<h3><?=$subtitle?></h3>
<input type="hidden" id="staffuser_id" value="<?=$staffuser->staffuser_id?>"/>

<div class="form_section" id="username_section">
<div class="title">Username: <span class="subtitle">(required)</span></div>
<input type="text" placeholder="Username" id="input_username" value="<?=$staffuser->staffuser_login?>" 
        <?if ($staffuser->staffuser_id > 0) echo "disabled='disabled'"?> class="input_field"/><span id="user_login_check"></span>
<div class="warning_section"></div>
</div>


<div class="form_section" id="email_section">
<div class="title">Email: <span class="subtitle">(required)</span></div>
<input type="text" placeholder="Email" id="input_email" value="<?=$staffuser->staffuser_email?>"  class="input_field"/><span id="user_email_check"></span>
<div class="warning_section"></div>
</div>


<div class="form_section" id="name_section">
<div class="title">Full Name: <span class="subtitle">(required)</span></div>
<input type="text" placeholder="Full Name" id="input_name" value="<?=$staffuser->staffuser_title?>" class="input_field"/>
<div class="warning_section"></div>
</div> 


<div class="form_section" id="role_section">
<div class="title">Role: <span class="subtitle">(Required)</span></div>

<select id="role_options">
    <?$role = $staffuser->staffuser_role;?>
    <option value="1" <?if($role == 1) echo "selected='selected'"; ?> ><?=get_role(1);?></option>
    <option value="2" <?if($role == 2) echo "selected='selected'"; ?> ><?=get_role(2);?></option>
    <? if($this->session->userdata('role') > 2):?>
    <option value="3" <?if($role == 3) echo "selected='selected'"; ?> ><?=get_role(3);?></option>
    <? endif; ?>
</select>
<div class="warning_section"></div>
</div>


<div class="form_section" id="password_section">
<div class="title">Password: <span class="subtitle">(Will be sent via email)</span></div>
<div id="password_location">
<?if ($staffuser->staffuser_id == -1):?>
    <div id="input_password"><?=$password?></div>
<?else:?>
    <td id="password"><input type="button" id="change_password" class="buttonLight" value="Reset Password"/>
<?endif;?>
</div>
<div class="warning_section"></div>
</div>

<div class="form_section" id="button_section">
<input type="button" id="submit_button" class="button" value="<?=$save_text?>" />
<input type="button" id="cancel_button" class="button" value="Cancel Changes" />
</div>
<input type="hidden" id="hidden_pass" value="<?=$password?>"/>
